/**
 * 异步动作
 */
export function getHotCitys(dispatch, getState) {
  console.log("getState", getState());

  // 调用接口
  fetch("https://m.maizuo.com/gateway", {
    headers: {
      "X-Host": "mall.film-ticket.city.list",
    },
  })
    .then((response) => response.json())
    .then((resp) => {
      console.log("resp", resp);
      const arr = resp.data.cities.filter((item) => item.isHot === 1);
      console.log("arr", arr);
      const arr2 = arr.map((item) => item.name);
      console.log("arr2", arr2);

      // 写入到 redux
      dispatch({ type: "SET", payload: arr2 });
    });
}
